package client.screen;

import javax.microedition.lcdui.*;

import client.MorcMIDlet;

final public class ScrapScreen extends Screen {
	private Command back, proceed;
	private TextField fromField, toField;
	
	public ScrapScreen(MorcMIDlet midlet, String title) {
		super(midlet, title);
		
		this.fromField = new TextField("De: ", this.midlet.getUser(), 32, TextField.PLAIN);
		this.toField = new TextField("Para: ", "", 32, TextField.PLAIN);
		
		this.append(this.fromField);
		this.append(this.toField);
	}

	protected void addCommands() {
		back = new Command("Voltar", Command.BACK, 0);
		proceed = new Command("Avancar", Command.OK, 0);
		
		this.addCommand(back);
		this.addCommand(proceed);
	}

	public void commandAction(Command c, Displayable d) {
		if (c == back) {
			this.midlet.setScreen(MorcMIDlet.SCREEN_MAIN);
		}
		else if (c == proceed) {
			this.midlet.setScreen(MorcMIDlet.SCREEN_SCRAPTEXT);
		}
	}
	
	public String getRecipient() { return this.toField.getString(); }

	public void setRecipient(String selectedFriend) {
		this.toField.setString(selectedFriend);
	}

}
